#ifndef SONG_H
#define SONG_H

/**
Nectarine Utility Project is a software interface for the web system 'demovibes'
Copyright (C) 2010  Alexandre LAURENT

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

website: http://code.google.com/p/nectarine-utility-project/
e-mail: lw.demoscene@gmail.com
**/

#include <QList>
#include <QDateTime>

#include <QDebug>

#include "artist.h"
#include "group.h"
#include "user.h"
#include "status.h"
#include "ptr.h"

class QByteArray;
class QXmlStreamReader;

typedef struct Song
{
    unsigned int id;
    QString title;
    unsigned int nbVotes;
    float actualNote;
    QList<struct Artist> artists;
    QList<struct Group> groups;
    // Tags
    Ptr <struct User> user; // To avoid imcomplete definition (Ptr has a known size)
    QTime lastQueued;
    QTime length;
    bool isLocked;
    QDateTime endLockDate;
    unsigned int pouetId;
    Status status;
    unsigned int bitrate;
    unsigned int sampleRate;
    QString type;
    QString platform;
    QString info;

    Song(void):id(0),title(""),nbVotes(0),actualNote(0),lastQueued(),length(),isLocked(true),endLockDate(),pouetId(0),status(S_INACTIVE),bitrate(0),sampleRate(0),type(""),platform(""),info("") {}
}Song;

QDebug operator<<(QDebug dbg, const Song& s);

bool parseSong(QXmlStreamReader& xmlReader, Song& s);
bool parseSongPage(QXmlStreamReader& xmlReader, Song& s);
bool readSongPage(const QByteArray& streamData, Song& s);

#endif // SONGINFO_H
